<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>M&oacute;dulo Administrador</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <script src="<?php echo base_url(); ?>js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="<?php echo base_url();?>js/jquery_ui.js"></script>
    
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
            <?php echo $pieChartScript; ?>
            <?php echo $barChartScript; ?>
        </script>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>js/bootstrap/css/bootstrap.css">       
    <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/theme.css">
    <link rel="stylesheet" href="<?php echo base_url(); ?>js/font-awesome/css/font-awesome.css">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/jquery_ui.css" />
    <!-- Demo page code -->

    <style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .brand { font-family: georgia, serif; }
        .brand .first {
            color: #ccc;
            font-style: italic;
        }
        .brand .second {
            color: #fff;
            font-weight: bold;
        }
    </style>

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons
    <link rel="shortcut icon" href="../assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
	-->
  </head>

  <!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
  <!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
  <!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
  <!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
  <!--[if (gt IE 9)|!(IE)]><!--> 
  <body class=""> 
  <!--<![endif]-->
    
    <div class="navbar">
        <div class="navbar-inner">
                <ul class="nav pull-right">
				
                    <li id="fat-menu" class="dropdown">
                        <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">
                            <i class="icon-user"></i> Susana 
                            <i class="icon-caret-down"></i>
                        </a>

                        <ul class="dropdown-menu">
                            <li><a tabindex="-1" class="visible-phone" href="#">Settings</a></li>
                            <li class="divider visible-phone"></li>
                            <li><a tabindex="-1" href="sign-in.html">Logout</a></li>
                        </ul>
                    </li>
                    
                </ul>
                <a class="brand" href="http://localhost/Modulo_Admin/AdminController"><span class="first">M&oacute;dulo</span> <span class="second">Administrador</span></a>
        </div>
    </div>
    


    
    <div class="sidebar-nav">
        <a href="#pacientes-menu" onclick="window.location = 'http://localhost/Modulo_Admin/';" class="nav-header" data-toggle="collapse"><i class="icon-dashboard"></i>Pacientes</a>
        <a href="#personal-menu" class="nav-header" data-toggle="collapse"><i class="icon-briefcase"></i>Personal <i class="icon-chevron-up"></i></a>
        <ul id="personal-menu" class="nav nav-list collapse">
            <li><a href="#" onclick="window.location = 'http://localhost/Modulo_Admin/AdminController/page/2';" >Doctores</a></li>
            <li><a href="#" onclick="window.location = 'http://localhost/Modulo_Admin/AdminController/page/4';" >Recepcionistas</a></li>
        </ul>
        <a href="#" onclick="window.location = 'http://localhost/Modulo_Admin/Reportes';" class="nav-header collapsed" data-toggle="collapse"><i class="icon-exclamation-sign"></i>Reportes </a>
        <a href="#configuracion-menu" class="nav-header" data-toggle="collapse"><i class="icon-legal"></i>Configuraciones <i class="icon-chevron-up"></i></a>
        <ul id="configuracion-menu" class="nav nav-list collapse">
                <li ><a href="#" onclick="window.location = '<?php echo base_url(); ?>AdminController/page/6';">Especialidades</a></li>
                <li ><a href="#" onclick="window.location = '<?php echo base_url(); ?>AdminController/page/7';">Parámetros</a></li>
        </ul>
    </div>
    

    
    <div class="content">
		<div class="header">
			<h1 class="page-title">Información Estadística de Citas</h1>
		</div>
		
		
		<fieldset class="container-fluid">
			<legend> Citas </legend>
			
                        <table width="90%">
                            
                            <tr>
                                <td>
                                    <table width="100%">
                                        <tr>
                                            <td style="text-align: center; width: 500px; "><label><?php echo $filterCondition; ?> </label></td>
                                            <td style="text-align: center"> </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            
                            
                            <tr>
                                <td>
                                    <table width="100%">
                                        <tr>
                                            <td style="width: 500px">
                                                <div style="height: 250px; width: 450px; border : solid 1px #000; margin-left: auto; margin-right: auto" id="chart_div"></div> 
                                            </td>
                                            <td>
                                                <form method="post" action="<?php echo site_url('Reportes/applyFilter'); ?>">
                                                    <table style="margin-left: auto; margin-right: auto; margin-top: auto; margin-bottom: auto;">
                                                        
                                                        <tr>
                                                            <td>
                                                                <label style="font-size: x-large; font-style: inherit">Filtros:</label>
                                                            </td>
                                                            <td>
                                                                &nbsp;
                                                            </td>
                                                        </tr>
                                                        
                                                        
                                                        <tr>
                                                            <td>
                                                                <div style="text-align: right; height: 35px">
                                                                    <label>Fecha Inicio: </label>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div style="text-align: left; height: 35px; margin-left: 30px">
                                                                    <input class="input-medium" id="fechaInicioTF" name="startDate" type="text">
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        
                                                        
                                                        <tr>        
                                                            <td>
                                                                <div style="text-align: right; height: 35px">
                                                                    <label>Fecha Fin: </label>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div style="text-align: left; height: 35px; margin-left: 30px">
                                                                    <input class="input-medium" id="fechaFinTF" name="endDate" type="text">
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        
                                                        
                                                        <tr>
                                                            <td>
								<div style="text-align: right; height: 35px">
                                                                    <label>Especialidad: </label>
                                                                </div>
                                                            </td>
                                                            <td>
								<div style="text-align: left; height: 35px; margin-left: 30px">
                                                                    <select name="specialty" style="width: 165px">
                                                                        <option value="0" selected>Todas</option>
                                                                        <?php foreach ($specialties as $specialty) { ?>
                                                                        <option value="<?php echo $specialty->ID_ESPECIALIDAD; ?>"><?php echo $specialty->nombre_especialidad; ?></option>
                                                                        <?php } ?>
                                                                    </select>
								</div>
                                                            </td>
							</tr>
                                                        
                                                        
                                                        <tr>
                                                            <td>
                                                                <div style="float:right;">
                                                                    &nbsp;
                                                                </div>  
                                                            </td>
                                                            <td>
                                                                <div style="float:right;">
                                                                    <button id="filterBtn" class="btn" style="margin-right: 60px" type="submit"><i class="icon-search"></i> Buscar</button>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        
                                                    </table>
                                                </form>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            
                            
                            
                            <tr>
                                <td>
                                    <table width="100%">
                                        <tr>
                                            <td style="width: 500px">
                                                
                                                <div style="border : solid 1px #000; height: 300px; width: 450px; overflow : auto; margin-left: auto; margin-right: auto">
                                                    <div id="barChartDiv" style="height: 280px; width: <?php echo $barChartDivWidth; ?>px">
                                                    
                                                    </div>
                                                </div>
                                            </td>
                                            <td>
                                                <form method="post" action="<?php echo site_url('Reportes/applyFilterVS'); ?>">
                                                    <table style="margin-left: auto; margin-right: auto; margin-top: 20px">
                                                        <tr>
                                                            <td style="text-align: center ;font-size: 16px"> Especialidad </td>
                                                            <td style="text-align: center; font-size: 16px"> Tipos de Cita</td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div style=" border : solid 1px #000; height: 250px; width: 190px; overflow : auto; margin-top: 20px">
                                                                    <table>
                                                                        <?php $count_a=1; ?>
                                                                        <?php foreach ($specialties as $specialty) { ?>
                                                                        <tr>
                                                                            <td>
                                                                                <input style="margin-bottom: auto; margin-top: auto" class="input-medium" id="firstCheck" name="<?php echo 'spec'.$count_a; ?>" value="<?php echo $specialty->ID_ESPECIALIDAD; ?>" type="checkbox">
                                                                            </td>
                                                                            <td>
                                                                                <?php echo $specialty->nombre_especialidad; ?>
                                                                            </td>
                                                                        </tr>
                                                                        <?php $count_a++; } ?>
                                                                    </table>
                                                                </div>        
                                                            </td>
                                                            
                                                            <td>
                                                                <div style="height: 250px; overflow : auto; border : solid 1px #000; margin-top: 20px">
                                                                    <table style="margin-left: auto; margin-right: auto">
                                                                        <?php $count_b=1; ?>
                                                                        <?php foreach ($apointmentStates as $state) { ?>
                                                                        <tr>
                                                                            <td>
                                                                                <input style="margin-bottom: auto; margin-top: auto" class="input-medium" id="firstCheck" name="<?php echo 'tipo'.$count_b; ?>" value="<?php echo $state->ID_ESTADO; ?>" type="checkbox">
                                                                            </td>
                                                                            <td>
                                                                                <?php echo $state->descripcion_estado; ?>
                                                                            </td>
                                                                        </tr>
                                                                        <?php $count_b++;} ?>
                                                                    </table>
                                                                    <table>
                                                                        <tr>
                                                                            <td style="height: 28px">
                                                                                
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>
                                                                                <button id="filterVSBtn" class="btn" type="submit"><i class="icon-search"></i> Buscar</button>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        
                                                    </table>
                                                </form>
                                                
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            
                            
                            <tr>
                                <td>
                                    <table width="100%">
                                        <tr>
                                            <td>
                                                <table style="margin-left: auto; margin-right: auto">
                                                    <tr>
                                                        <td>
                                                        </td>
                                                    </tr>
                                                    
                                                    <tr>
                                                        <td>
                                                            <div>
                                                                <label>Doctores Calificados: <?php echo count($ratedDoctors); ?></label>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    
                                                    <tr>
                                                        <td>
                                                            <a href="#modalVerCalificacion" role="button" data-toggle="modal">
                                                                <button class="btn" type="button"><i class="icon-plus"></i> Ver Calificación de Doctores</button>
                                                            </a>
                                                        </td>
                                                    </tr>
                                             </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            
                            
                        </table> 
                            
                         
		</fieldset>
           
        </div>
  
  
        <div class="modal small hide fade" id="modalVerCalificacion" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:800px;margin-left:-400px;margin-top: -250px">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
					<h3 id="myModalLabel">Médicos Calificados</h3>
				</div>
				<div class="modal-body" style="padding:15px;">
                                
                                            
						<table class="table" style="width:100%;">
                                                        <tr>
                                                                <th><label> Nombres </label></th>
                                                                <th><label> Apellidos </label></th>
                                                                <th><label> Especialidad </label></th>
								<th><label> Calificación Promedio</label></th>
							</tr>
                                                        
                                                        <?php for($i=0; $i<count($ratedDoctors); $i++) { ?>
                                                        <?php $doctor = $ratedDoctors[$i]; ?>
                                                        <tr>
                                                            <td><?php echo $doctor['nombres']; ?></td>
                                                            <td><?php echo $doctor['apellido_paterno'].' '.$doctor['apellido_materno']; ?></td>
                                                            <td><?php echo $doctor['cmp']; ?></td>
                                                            <td><?php echo $doctor['average']; ?></td>
                                                        </tr>
                                                        
                                                        
                                                        <?php } ?>
						</table>
					
				</div>
				<div class="modal-footer">
                                <button id ="cancelButton" class="btn" data-dismiss="modal" type="button" aria-hidden="true">Cancelar</button>
                                </div>
	</div>
    
    <script>
        $(document).ready(function() {
            
            var startDate = $('#fechaInicioTF');
            var endDate = $('#fechaFinTF');
            var filterBtn = $('#filterBtn');
            
            
            startDate.keyup(function () {
                // check if input is empty, so it could be enabled
                if(startDate.val() === ""){
                    filterBtn.attr('disabled', false);
                    endDate.datepicker("option", "minDate", "01/01/1800");
                }
                
                if(endDate.val() === ""){
                    filterBtn.attr('disabled', false);
                    startDate.datepicker("option", "maxDate", "31/12/2100");
                }
                
            });
            
            
            startDate.datepicker({
                dateFormat: 'dd/mm/yy',
                onSelect: function(selected) {
                    endDate.datepicker("option","minDate", selected);
                    if (filterBtn.is(':disabled')){
                        filterBtn.attr('disabled', false);
                    }else{
                        filterBtn.attr('disabled', true);
                    }
                }
            });
            
            endDate.datepicker({
                dateFormat: 'dd/mm/yy',
                onSelect: function(selected) {
                    startDate.datepicker("option","maxDate", selected);
                    if (filterBtn.is(':disabled')){
                        filterBtn.attr('disabled', false);
                    }else{
                        filterBtn.attr('disabled', true);
                    }
            }
            });
        });
    
    </script>
   

    <script src="<?php echo base_url();?>js/bootstrap/js/bootstrap.js"></script>
    
    
    
  </body>
</html>


